﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NGI_Logica;
using NGI_Enumerador;
using NGI_Mensaje;

namespace NGI_Sistema.Forms
{
    public partial class frmContrasenaActual : Form
    {
        #region Propiedades
        public Delegate guardarFunctionPointer;
        private Int32 _id = 0;
        #endregion Propiedades

        public frmContrasenaActual(Int32 ID)
        {
            this._id = ID;
            InitializeComponent();
        }

        #region Eventos

        private void frmContrasenaActual_Load(object sender, EventArgs e) {}

        private void btnCancelar_Click(object sender, EventArgs e)
        {
            this.Dispose();
        }

        private void btnAceptar_Click(object sender, EventArgs e)
        {
            if (Usuarios.ChequearContrasenaCorrecta(this._id, this.txtContrasena.Text)){
                guardarFunctionPointer.DynamicInvoke();
                this.Dispose();
            }else{
                Mensaje.MostrarMensaje(TipoMensajes.ContrasenaActualInvalida, TipoCarteles.Error, TipoBotones.OK);
                this.txtContrasena.Focus();
            }
        }

        #endregion Eventos
    }
}
